<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<div id="app">
			<div>
				<!-- prevent:阻止默认行为
				     stop：阻止冒泡行为
				 -->
				 <!-- 自定义修饰符：Vue.config.keyCodes.f1=112 -->
				 <!-- keyCode可以看到键盘对应的数字 -->
				 
				 
				<a href="http://sina.com" @click.prevent.stop="aclick">点击我试试</a>
				<form action="" method="">
					用户名：<input type="text" name="" id="" value="" v-model="username" @keyup.delete="clearvalue"/>
					密码：<input type="password" name="" v-model="password" @keyup.enter="sub"/>
					<input type="submit" name="" id="" value="提交" @click="sub"/>	
				</form>
			<input type="text" name="" id="" placeholder="请输入..." value="" @keyup.a="aa"/>
			</div>
		</div>
		<script src="vue.js"></script>
		<script type="text/javascript">
			
			// 自定义修饰符
			Vue.config.keyCodes.a = 65
			
			var vm = new Vue({
				el: "#app",
				data: {
					username: null,
					password: null
				},
				methods: {
					// divclick() {
					// 	alert('我是div标签')
					// },
					aclick() {
						alert('我是a标签')
					},
					sub() {
						alert('提交成功')
						console.log(this.username,this.password)
					},
					clearvalue() {
						this.username= ''
					},
					aa() {
						alert('好极了')
					}
				}
			})
		</script>
	</body>
</html>
